<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class AuthController extends Controller
{
    /**
     * todo create register
     * todo create login
     * todo create logout
     */

    public function login(Request $request)
    {
        $account = $request->get('account');
        $password = $request->get('password');
        $user = $this->authService->login($account, $password);
        if(!$user) {
            return $this->failed("User name or password is incorrect !");
        }
        return $this->success($user);
    }
}
